package com.soup.lab.spring.aop.order;

import com.soup.lab.spring.aop.SampleService;
import com.soup.lab.spring.aop.SpringAOPApplication;
import org.junit.jupiter.api.Test;
import org.springframework.aop.Advisor;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.framework.Advised;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest(classes = SpringAOPApplication.class)
public class OrderTestCase {

    @Autowired
    private SampleService sampleService;

    @Test
    public void testOrder() {
        sampleService.test("abc");
    }

    @Test
    public void testAdvised() throws Exception {
        Advised advised = (Advised) this.sampleService;
        Object target = advised.getTargetSource().getTarget();
        System.out.println(target);
    }

}
